<?php


namespace designpatterns\factory;

use designpatterns\factory\other\Circle;
use designpatterns\factory\other\Square;


class ShapeFactory
{
    public static function createShape($name, $size = 1)
    {
        switch ($name) {
            case 'circle':
                return new Circle($size);
            case 'square':
                return new Square($size);
            default:
                throw new \Exception("Invalid shape name: " . $name);
        }
    }
}